import React, { Component } from 'react';
import { connect } from 'dva';
import { FormattedMessage, formatMessage } from 'umi/locale';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import MenuView from '@/components/MenuView';
import get from 'lodash/get'
import { Card } from 'antd'

@connect(({ user }) => ({
  currentUser: user.currentUser
}))
class Info extends Component {
  constructor(props) {
    super(props);
    const { currentUser } = props;
    this.state = {
      menuMap: {}
    }
  }
  static getDerivedStateFromProps(props, state) {
    const { match, location, currentUser } = props;

    let isEnterprise = false;
    if (currentUser.account) {
      isEnterprise = (!currentUser.account.authStatus && !currentUser.account.enterprise)
        || (currentUser.account.authStatus && currentUser.account.enterprise);
    }
    const menuMap = {
      password: {
        path: '/account/info/password',
        title: <FormattedMessage id="menu.account.info.password" />,
      }
    };
    return {
      menuMap
    }
  }

  render() {
    const { children, ...restProps } = this.props;
    const { menuMap } = this.state;
    return (
      <PageHeaderWrapper title='修改密码'>
        <Card bordered={false}>
          {children}
        </Card>
      </PageHeaderWrapper>
    );
  }
}

export default Info;
